Source for file containers.class.php
Documentation is available at containers.class.php
/** @var int ID for container record in database */
/** @var string Window title */
/** @var string Key words */
/** @var int ID of parent container in database if a folder */
/** @var string Name of container */
/** @var string Container description */
/** @var bool Is the container published? */
/** @var string Icon - not sure how this is used */
/** @var bool Has all the data been loaded (rather than just the basics) */
/** @var array Child containers */
/** @var bool When true, the item is marked as trash */
return array ('id', 'loaded', 'children', 'database');
$database->setQuery("SELECT * FROM #__containers WHERE id=$this->id");
$database->loadObject($this);
if ($this->id ==
0) $database->doSQL($this->insertSQL());
else $database->doSQL($this->updateSQL());
foreach ($folders as $folder) $folder->deleteAll ();
// Need to delete things that are registered with this
else $mainframe->prependMetaTag('keywords', $this->name);
if ($this->parentid OR $showself) return $category->name;
while ($container->parentid) $container =
& $container->getParent();
$names =
$include ?
'/'.
$this->name :
'';
while ($ancestor->parentid AND $generation <
3) {
$ancestor =
& $ancestor->getParent();
$names =
'/'.
$ancestor->name.
$names;
if ($ancestor->parentid) $names =
'..'.
$names;
if ($names) return $names;
function &addChildren (&$descendants, $published=
true, $search=
'', $recurse=
false) {
$container =
& $handler->getBasicContainer($i);
if ($published AND $container->published ==
0) continue;
$children[] =
& $container;
$descendants[] =
& $container;
if ($recurse) foreach ($children as $child) $child->addChildren ($descendants, $published, $search, $recurse);
$this->addChildren ($descendants, false, $search, true);
$parent =
& $handler->getBasicContainer($this->parentid);
foreach ($handler->getCategories() as $category) $category->addSelectList('',$selector,$notThis,$published);
function addSelectList ($prefix, &$selector, $notThis, $published) {
foreach ($this->getChildren($published) as $container) $container->addSelectList($prefix.
$this->name.
'/',$selector,$notThis,$published);
$iconDir =
new mosDirectory (mamboCore::get('mosConfig_absolute_path').
'/administrator/components/com_containers/images/folder_icons');
$files =
$iconDir->listAll();
foreach ($files as $file) {
$iconList.=
"\n<a href=\"JavaScript:paste_strinL('{$file}')\" onmouseover=\"window.status='{$file}'; return true\"><img src=\"{$live_site}/administrator/components/com_containers/images/folder_icons/{$file}\" width=\"32\" height=\"32\" border=\"0\" alt=\"{$file}\" /></a> ";
if ($ss %
10 ==
0) $iconList.=
"<br/>\n";
$sql =
"UPDATE #__downloads_containers SET published=$value".
"\nWHERE id IN ($cids)";
remositoryRepository::doSQL ($sql);
function mosImageURL($imageName, $width=
32, $height=
32) {
$element .=
$live_site.
'/administrator/components/com_containers/images/'.
$imageName;
$element .=
'" height="';
$element .=
'" border="0" align="middle" alt="';
$sql =
'SELECT id, parentid, name, published, ordering FROM #__containers ORDER BY ordering, name';
$this->rows =
& $database->doSQLget($sql, 'mosContainer');
foreach ($this->rows as $i=>
$row) $this->links[$row->id] =
$i;
foreach ($this->rows as $row) if ($row->parentid) {
$parent =
& $this->rows[$this->links[$row->parentid]];
$parent->addChild($row->id);
else $this->anchor->addChild($row->id);
if ($id ==
0) return $this->anchor;
foreach ($this->anchor->getChildren() as $category) {
if ($published AND $category->published ==
0) continue;
$categories[] =
$category;
$descendants =
& $top->getDescendants ($search);
foreach ($descendants as $descendant) $list .=
','.
$descendant->id;
function getSelectList ($allowTop, $default, $type, $parm, &$user) {
foreach ($this->getCategories() as $category) $category->addSelectList('', $selector, null, $user);
if (isset
($selector)) return mosHTML::selectList( $selector, $type, $parm, 'value', 'text', $default );
// Only needed for testing
echo
'<br />'.
$container->name.
' has children:<br />';
foreach ($container->children as $child) echo
$child->name.
' whose parent is '.
$child->parent->name.
'<br />';
foreach ($this->rows as $row) if ($row->isTrash()) $trash[] =
$row->id;
$trashlist =
implode (',', $trash);
$sql =
"DELETE FROM #__containers WHERE id IN ($trashlist)";
Documentation generated on Mon, 05 May 2008 16:18:16 +0400 by phpDocumentor 1.4.0